CentOS 7 挂载硬盘
--
1. 查看磁盘情况:fdisk -l
[root@localhost /]# fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b714e
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83886079 41942016 83 Linux
Disk /dev/vdb: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
2. 格式化
命令是:
mke2fs -t ext4 /dev/vdb
或者
mke2fs -t ext3 /dev/vdb
过程
[root@localhost /]# mke2fs -t ext3 /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3932160 inodes, 15728640 blocks
786432 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
480 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
3. 挂载到 /data
文件夹上
mount /dev/vdb /data
4. 查看 df -h
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 909M 0 909M 0% /dev
tmpfs 920M 0 920M 0% /dev/shm
tmpfs 920M 52M 868M 6% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 40G 3.0G 37G 8% /
tmpfs 184M 0 184M 0% /run/user/0
/dev/vdb 59G 52M 56G 1% /data